package com.xk857.simpleeffect.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

public class TabViewPagerAdapter extends FragmentStateAdapter {

    private final Fragment[] fragmentList;

    public TabViewPagerAdapter(@NonNull FragmentActivity fragmentActivity, Fragment[] fragmentList) {
        super(fragmentActivity);
        this.fragmentList = fragmentList;
    }


    @NonNull
    @Override
    public Fragment createFragment(int position) {
        return fragmentList[position];
    }

    @Override
    public int getItemCount() {
        return fragmentList.length;
    }
}
